#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
extern signed char A;
extern signed short B;
extern signed int C;
extern signed long long D;
extern unsigned char E;
extern unsigned short F;
extern unsigned int G;
extern unsigned long long H;
extern bool I;
extern unsigned char J;
extern unsigned short K;
extern unsigned int L;
extern unsigned long long M;
extern float N;
extern double O;
extern char P[255];
extern char Q[255];
extern char R;
extern wchar_t S;
extern int T;
extern int V;
typedef struct{
	char name[255];
	signed short age;
	signed int tt;
}_StructOfStudent;
extern _StructOfStudent StructOfStudent;
extern int Y[2];
extern bool Z[2];
extern int ty_date;
extern int ty_tod;
extern int ty_time;
extern void* pp;
extern int setValue(char* name, char* type, void* value)
{
	if(strcmp(name,"A") == 0 && strcmp(type,"SINT")==0){
		A = *(signed char*) value;
		return 1;
	}
	if(strcmp(name,"B") == 0 && strcmp(type,"INT")==0){
		B = *(signed short*) value;
		return 1;
	}
	if(strcmp(name,"C") == 0 && strcmp(type,"DINT")==0){
		C = *(signed int*) value;
		return 1;
	}
	if(strcmp(name,"D") == 0 && strcmp(type,"LINT")==0){
		D = *(signed long long*) value;
		return 1;
	}
	if(strcmp(name,"E") == 0 && strcmp(type,"USINT")==0){
		E = *(unsigned char*) value;
		return 1;
	}
	if(strcmp(name,"F") == 0 && strcmp(type,"UINT")==0){
		F = *(unsigned short*) value;
		return 1;
	}
	if(strcmp(name,"G") == 0 && strcmp(type,"UDINT")==0){
		G = *(unsigned int*) value;
		return 1;
	}
	if(strcmp(name,"H") == 0 && strcmp(type,"ULINT")==0){
		H = *(unsigned long long*) value;
		return 1;
	}
	if(strcmp(name,"I") == 0 && strcmp(type,"BOOL")==0){
		I = *(bool*) value;
		return 1;
	}
	if(strcmp(name,"J") == 0 && strcmp(type,"BYTE")==0){
		J = *(unsigned char*) value;
		return 1;
	}
	if(strcmp(name,"K") == 0 && strcmp(type,"WORD")==0){
		K = *(unsigned short*) value;
		return 1;
	}
	if(strcmp(name,"L") == 0 && strcmp(type,"DWORD")==0){
		L = *(unsigned int*) value;
		return 1;
	}
	if(strcmp(name,"M") == 0 && strcmp(type,"LWORD")==0){
		M = *(unsigned long long*) value;
		return 1;
	}
	if(strcmp(name,"N") == 0 && strcmp(type,"REAL")==0){
		N = *(float*) value;
		return 1;
	}
	if(strcmp(name,"O") == 0 && strcmp(type,"LREAL")==0){
		O = *(double*) value;
		return 1;
	}
	if(strcmp(name,"P") == 0 && strcmp(type,"STRING")==0){
		sprintf((char*)P,"%s",(char*)value);
		return 1;
	}
	if(strcmp(name,"Q") == 0 && strcmp(type,"WSTRING")==0){
		swprintf((wchar_t*)Q,255,L"%s",(wchar_t*)value);
		return 1;
	}
	if(strcmp(name,"R") == 0 && strcmp(type,"CHAR")==0){
		R = *(char*) value;
		return 1;
	}
	if(strcmp(name,"S") == 0 && strcmp(type,"WCHAR")==0){
		S = *(wchar_t*) value;
		return 1;
	}
	if(strcmp(name,"T") == 0 && strcmp(type,"TIME")==0){
		T = *(int*) value;
		return 1;
	}
	if(strcmp(name,"V") == 0 && strcmp(type,"DATE_AND_TIME")==0){
		V = *(int*) value;
		return 1;
	}
	if(strcmp(name,"StructOfStudent") == 0 && strcmp(type,"STRUCT")==0){
		memcpy(&StructOfStudent,value,261); 
		return 1;
	};
	if(strcmp(name,"Y") == 0 && strcmp(type,"Array_INT")==0){
		memset(Y,0,sizeof(int)*2); 
		memcpy(Y,value,sizeof(int)*2); 
		return 1;
	};
	if(strcmp(name,"Z") == 0 && strcmp(type,"Array_BOOL")==0){
		memset(Z,0,sizeof(int)*2); 
		memcpy(Z,value,sizeof(int)*2); 
		return 1;
	};
	if(strcmp(name,"ty_date") == 0 && strcmp(type,"DATE")==0){
		ty_date = *(int*) value;
		return 1;
	}
	if(strcmp(name,"ty_tod") == 0 && strcmp(type,"TIME_OF_DAY")==0){
		ty_tod = *(int*) value;
		return 1;
	}
	if(strcmp(name,"ty_time") == 0 && strcmp(type,"TIME")==0){
		ty_time = *(int*) value;
		return 1;
	}
	if(strcmp(name,"pp") == 0 && strcmp(type,"POINTER")==0){
		pp = value;
		return 1;
	}
	printf("Symbol not found!!");
	return 0;
}
